'use strict';

import Base from './base.js';

export default class extends Base {
  /**
   * index action
   * @return {Promise} []
   */
  /*获取用户参加过的所有项目*/
  async indexAction(){
    let uid = this.get('uid')
    if(!uid){
      this.error('该用户不存在');
      return false;
    }
    //let product_user = this.model('product_user');
    let product_user = this.model();
    let data = await product_user.query('select a.score,a.id as pid,a.title,a.id,a.owner,a.productdate,a.status,a.createtime,user.name from (select product.title,product.id,product.owner,product.productdate,product.status,product.createtime,product_user.score from product left join product_user on product.id=product_user.pid where product_user.userid = '+uid+' and product.is_show!=0  order by product.createtime desc) as a left join user on  a.owner=user.id')
    this.success(data);
  }
}